<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('projects', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('company_id')->index();
            $table->string('name')->nullable()->comment('项目名称');
            $table->string('number')->nullable()->index()->comment('项目编号');
            $table->string('contract_name')->nullable()->comment('合同名称');
            $table->string('contract_number')->nullable()->comment('合同编号');
            $table->string('internal_contract_number')->nullable()->comment('内部合同编号');
            $table->string('item_name')->nullable()->comment('立项名称');
            $table->string('item_number')->index()->nullable()->comment('立项编号');
            $table->string('director')->nullable()->comment('项目负责人');
            $table->string('tax_rate')->nullable()->comment('税率');
            $table->date('start_date')->nullable()->comment('合同开工日期');
            $table->date('end_date')->nullable()->comment('合同竣工日期');
            $table->string('address')->nullable()->comment('工程地址');
            $table->string('situation')->nullable()->comment('经纬度');
            $table->string('map_address')->nullable()->comment('地图选点');
            $table->string('construction_content')->nullable()->comment('施工内容');
            $table->tinyInteger('is_rush')->default(0)->comment('是否抢工');
            $table->tinyInteger('is_model_houses')->default(0)->comment('是否样板房');
            $table->string('construction_unit')->nullable()->comment('建设单位');
            $table->string('business_type')->nullable()->comment('经营类型');
            $table->decimal('price')->nullable()->default(0)->comment('合同总金额');
            $table->string('taxation_method')->nullable()->comment('计税方式');
            $table->string('quality_requirement')->nullable()->comment('质量要求');
            $table->string('risk')->nullable()->comment('工期风险描述');
            $table->tinyInteger('is_award_presentation')->default(0)->comment('是否报奖');
            $table->string('attendance_type')->default('')->comment('打卡类型');
            $table->string('remarks')->nullable()->comment('备注');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('projects');
    }
};
